package com.hsc.www.dealLetter;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class UserReceiver {

    @RabbitListener(queues = "deal3")
    public void receive(Channel channel, org.springframework.amqp.core.Message amqpMessage, Message message)  throws Exception{


        channel.basicNack(amqpMessage.getMessageProperties().getDeliveryTag(),false,false);

//        throw new RuntimeException("消费异常：" + user.toString()); new String(amqpMessage.getBody(),"ISO-8859-1").getBytes("ISO-8859-1")
        //{"body":"rO0ABXNyABBjb20uaHNjLnd3dy5Vc2VyM79FLxSURCQCAAFMAARuYW1ldAASTGphdmEvbGFuZy9PYmplY3Q7eHB0AARkb2cw","messageProperties":{"consumerQueue":"dogQueue","consumerTag":"amq.ctag-guAD6yIKR3AxRUgfn0UK2w","contentLength":0,"contentType":"application/x-java-serialized-object","deliveryTag":1,"finalRetryForMessageWithNoId":false,"headers":{},"priority":0,"publishSequenceNumber":0,"receivedDeliveryMode":"PERSISTENT","receivedExchange":"dogExchange","receivedRoutingKey":"dogRoutingKey","redelivered":false}}
    }

}
